//sku模块接口管理
import request from '@/utils/request'
import type { SkuInfoData, SkuResponseData } from './type'
enum API {
  //获取已有商品的数据-SKU
  SKU_URL = '/admin/product/list/',
  //商品上架接口
  SALE_URL = '/admin/product/onSale',
  //商品下架接口
  CANCELSALE_URL = '/admin/product/cancelSale/',
  //获取商品详情地址
  SKUINFO_URL = '/admin/product/getSkuInfo',
  //删除商品接口地址
  DELETE_SKU = '/admin/product/deleteSku/',
}

//获取商品SKU的接口方法
export const reqSkuList = (page: number, limit: number) => {
  request.get<any, SkuResponseData>(API.SKU_URL + `${page}/${limit}`)
}
//上架接口方法
export const reqSaleSku = (skuId: number) => {
  request.get(API.SALE_URL + skuId)
}
//下架接口的方法
export const reqCancelSale = (skuId: number) => {
  request.get<any, any>(API.CANCELSALE_URL + skuId)
}
//获取商品详情的接口
export const reqSkuInfo = (skuId: number) => {
  request.get<any, SkuInfoData>(API.SKUINFO_URL + skuId)
}
//删除商品接口方法
export const reqDeletaSku = (skuId: number) => {
  request.delete<any, any>(API.DELETE_SKU + skuId)
}
